//
//  SSPPublishContentItemViewModel.m
//  EnvironmentalProtection
//
//  Created by HCreater on 2018/10/29.
//  Copyright © 2018年 HCreater. All rights reserved.
//

#import "SSPPublishContentItemViewModel.h"

@interface SSPPublishContentItemViewModel ()

/// 商品模型
//@property (nonatomic, readwrite, strong) EnterpriseInfoData* epInfoData;

@end

@implementation SSPPublishContentItemViewModel

- (instancetype)initWithData:(id)data cellHeight:(CGFloat)cellHeight
{
    self = [super init];
    if (self)
    {
        //        _epInfoData = data;
        
        _isShowTags = YES;
        _isShowDetail = YES;
        
        _data = data;
        
        /// cellHeight+2（2容错）
        _cellHeight = MHUIScaleValue(cellHeight)+2;
        
        @weakify(self);
        _avatarCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input)
        {
            @strongify(self);
            
            NSString* userID = @"";
            if ([self.data isKindOfClass:[SSPListData class]])
            {
                SSPListData* listData = self.data;
                userID = listData.userID;
            }
            else if ([self.data isKindOfClass:[SSPDetailData class]])
            {
                SSPDetailData* detailData = self.data;
                userID = detailData.userID;
            }
            
            return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber)
            {
                [subscriber sendNext:userID];
                [subscriber sendCompleted];
                
                return nil;
            }];
        }];
    }
    
    return self;
}

@end
